<h3 class="title-popup">Form Ubah Data Group User</h3>

<form action="" method="post">
    <?php if ($message != ""): ?>
        <div class="BoxMessage Warning"><br /><?php echo $message; ?></div>
    <?php endif; ?>
    <fieldset class="fldInput">
        <dl>
            <dt class="mandatory">Nama Group</dt>
            <dd>
                <input type="text" name="group_user" id="group_user" value="<?php echo $group_user; ?>" />
            </dd>

            <dt>Keterangan</dt>
            <dd>
                <textarea name="keterangan" id="keterangan" style="width:300px; height:200px; text-align: left"><?php echo $keterangan; ?></textarea>
            </dd>

            <dt>Master Group</dt>
            <dd>
                <input type="text" name="master_group" id="master_group" value="<?php echo $master_group; ?>" readonly="readonly" class="read-only" />
                <input type="hidden" name="id_master_group" id="id_master_group" value="<?php echo $id_master_group; ?>" />
                <a title="Cari Master Group" class="find" onclick="return GB_showCenter('Cari Master Group', '<?php echo base_url() ?>index.php/management/user_group_master', 450, 750)"><span>Cari</span></a>
            </dd>
            <dt>Hak Akses Default</dt>
            <dd>
                <a title="Buat Default Hak Akses" class="add" onclick="showHakAksesPopup()">&nbsp;</a>
                <?php if(isset($default_hak_akses)): ?>
                    <br />
                    <table class="GridTable" style="margin-top:10px; clear:both; width:100%; margin-top:10px">
                        <tbody>
                            <tr class="GridHeader">
                                <td>
                                    No.
                                </td>
                                <td>
                                    ID
                                </td>
                                <td>
                                    Nama Menu
                                </td>
                                <td>
                                    Group Menu
                                </td>
                                <td>
                                    Read
                                </td>
                                <td>
                                    Edit
                                </td>
                                <td>
                                    Delete
                                </td>
                            </tr>
                            <?php $counter = 1 ?>
                            <?php foreach($menus->result() as $menu): ?>
                                <?php if(isset($default_hak_akses[$menu->id_menu])): ?>
                                <tr class="GridItem1">
                                    <td>
                                        <?php echo $counter; ?>
                                    </td>
                                    <td>
                                        <?php echo $menu->id_menu ?>
                                    </td>
                                    <td>
                                        <?php echo $menu->menu ?>
                                    </td>
                                    <td>
                                        <?php echo $menu->menu_group ?>
                                    </td>
                                    <td>
                                        <span><?php echo isset($default_hak_akses[$menu->id_menu]["is_read"])?"Ada Akses":"Tidak ada akses" ?></span>
                                    </td>
                                    <td>
                                        <span><?php echo isset($default_hak_akses[$menu->id_menu]["is_modify"])?"Ada Akses":"Tidak ada akses" ?></span>
                                    </td>
                                    <td>
                                        <span><?php echo isset($default_hak_akses[$menu->id_menu]["is_delete"])?"Ada Akses":"Tidak ada akses" ?></span>
                                    </td>
                                </tr>
                                <?php $counter++; ?>
                                <?php endif; ?>
                            <?php endforeach; ?>
                        </tbody>
                    </table>
                <?php endif; ?>
            </dd>
            <br/>
            <dt>&nbsp;</dt>
            <dd>
                <ul id="note">
                    <li>Field dengan remark harus diisi.</li>
                    <li>Gunakan tombol Cari untuk field dengan property read-only.</li>
                </ul>

            </dd>
        </dl>
    </fieldset>
    <div id="box-control-save">
        <input type="submit" class="CommandButton" name="btnSimpan" value="Save"/>&nbsp;
        <input type="button" class="CommandButton" value="Cancel" onclick="javascript:closeGB_();"/>
    </div>
</form>
<script type="text/javascript">
    function closeGB_ ()
    {
        <?php echo CloseGB(true); ?>
    }
    
    function showHakAksesPopup()
    {
        var group_user = jQuery("#group_user").val();
        var keterangan = jQuery("#keterangan").val();
        var master_group = jQuery("#master_group").val();
        var id_master_group = jQuery("#id_master_group").val();
        
        return GB_showCenter('Buat Default Hak Akses', '<?php echo base_url() ?>index.php/management/user_group_hak_akses/add/' + group_user + "/" + keterangan + "/" + master_group + "/" + id_master_group, 450, 750)
    }
    
    function _obj_fSendValue(kode, nama, elmKode, elmNama) {
        var elmk = document.getElementById("" + elmKode + "");
        var elmn = document.getElementById("" + elmNama + "");
        try {
            elmk.value = kode;
            elmn.value = nama;
        }
        catch(e) {
            alert(e.message);
        }
    }
</script>
